package com.thh.es.controller;

import com.thh.es.service.FileSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @description:
 * @author: thh
 * @time: 2020/5/26 21:53
 */
@RestController
@RequestMapping("/fileSearch")
public class FileSearchController {

    @Autowired
    private FileSearchService fileSearchService;


    @PostMapping("/importData")
    public String importData(){
        fileSearchService.importData();

        return "success";
    }

    @PostMapping("/search")
    public Map search(@RequestParam(required = false) Map<String, String> searchMap) {

        Map<String, Object> dataMap = fileSearchService.search(searchMap);

        return dataMap;

    }


}
